package cn.autumnorange.app.user.api;

import cn.autumnorange.app.common.dto.ResultDto;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class AccountFallbackFactory implements FallbackFactory<MoneyService> {

  @Override
  public MoneyService create(Throwable throwable) {
    return new MoneyService() {
      @Override
      public ResultDto<MoneyDto> add(Long money, Long version) {
        log.info("account-service add error massgae:" + throwable.getMessage());
        //        return new ResultDto<MoneyDto>(500, throwable.getMessage());
        return null;
      }

      @Override
      public ResultDto<MoneyDto> getmoney() {
        //        return new ResultDto<MoneyDto>(500, throwable.getMessage());
        return null;
      }

      @Override
      public ResultDto<MoneyDto> resetacc() {
        //        return new ResultDto<MoneyDto>(500, throwable.getMessage());
        return null;
      }
    };
  }
}
